﻿using System;
using Notoric.Commanding.CommandBase;

namespace Notoric.ViewModel.Elements
{
    /// <summary>
    /// Abstract base class for section interiors.
    /// </summary>
    public abstract class SectionInterior : ViewModelElement
    {
        #region Constructors

        /// <summary>
        /// Creates a new <see cref="SectionInterior"/> instance.
        /// </summary>
        /// <param name="adaptedElement">
        /// <para>
        /// Type: <see cref="Model.Elements.SectionInteriorElement"/>
        /// </para>
        /// <para>
        /// The adapted model element instance.
        /// </para>
        /// </param>
        /// <param name="owner">
        /// <para>
        /// Type: <see cref="Section"/>
        /// </para>
        /// <para>
        /// The section that directly owns this interior.
        /// </para>
        /// </param>
        /// <param name="undoStack">
        /// <para>
        /// Type: <see cref="CommandStack"/>
        /// </para>
        /// <para>
        /// The undo stack for this element.
        /// </para>
        /// </param>
        /// <param name="redoStack">
        /// <para>
        /// Type: <see cref="CommandStack"/>
        /// </para>
        /// <para>
        /// The redo stack for this element.
        /// </para>
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Any of the arguments is <see langword="null"/>.
        /// </exception>
        public SectionInterior(Model.Elements.SectionInteriorElement adaptedElement, Section owner, CommandStack undoStack, CommandStack redoStack)
            : base(adaptedElement, owner, undoStack, redoStack)
        {
			
        }

        #endregion

        #region Protected Methods

        /// <summary>
        /// When overriden in a derived class, this method clears
        /// the current selection inside the section.
        /// </summary>
        protected abstract void ClearSelectionCore();

        #endregion

        #region Public Methods

        /// <summary>
        /// Clears the selection.
        /// </summary>
        public void ClearSelection()
        {
            ClearSelectionCore();

            IsContentSelected = false;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets a value indicating whether some content is selected inside this section.
        /// </summary>
        /// <value>
        /// Indicates whether some content is currently selected inside the section.
        /// </value>
        public bool IsContentSelected
        {
            get { return isContentSelected; }
            protected set
            {
                isContentSelected = value;

                RaisePropertyChanged("IsContentSelected");
            }
        }

        #endregion

        #region Private Fields

        /// <summary>
        /// Holds the value of the <see cref="IsContentSelected"/> property.
        /// </summary>
        private bool isContentSelected;

        #endregion
    }
}
